package com.hq.fxh.Utils;

import android.app.Activity;
import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.hq.fxh.R;
import com.hq.fxh.CustomerView.PopupWindow.PopupForComment;

import static com.hq.fxh.R.id.imageView;


/**
 * /**
 *
 * @author 薛
 * @ClassName
 * @Description :
 * @Created 2017/8/16
 * @Email xlwenhao1858@sina.com
 */


public class ClickUtils {
    private static PopupForComment customPopupForComment;

    public static boolean clickZhan(Context context, ImageView imageView, TextView textView, Boolean status) {
        if (status) {
            imageView.setImageResource(R.mipmap.tu_zan_to);
            textView.setTextColor(context.getResources().getColor(R.color.red));
            return true;
        } else {
            imageView.setImageResource(R.mipmap.tu_zan);
            textView.setTextColor(context.getResources().getColor(R.color.grey));
            return false;
        }
    }

    public static void clickComment(final Activity mActivity, View view) {

        customPopupForComment = new PopupForComment(mActivity, new PopupForComment.CommentCallBack() {
            @Override
            public void call(String comment) {

                /*    commentData = comment;
                    sentComment(comment);*/
            }
        });

        customPopupForComment.openKeyboard();
        Tool.setAlpha(mActivity, 0.6f);
        customPopupForComment.showAtLocation(view,
                Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0);
    }

    public static boolean clickShouChang(Context context, ImageView imageView, boolean status) {
        if (status) {
            imageView.setImageResource(R.mipmap.tu_shoucang_to);
            return false;
        } else {
            imageView.setImageResource(R.mipmap.tu_shoucang);
            return true;

        }

    }

    public static boolean clickGuanzhu(Context context, TextView textView, boolean status) {
        if (status) {
            textView.setBackgroundResource(R.drawable.style_guanzu_to);
            textView.setTextColor(context.getResources().getColor(R.color.textgrey));
            textView.setText("已关注");

            return true;
        } else {
            textView.setBackgroundResource(R.drawable.style_guanzu);
            textView.setTextColor(context.getResources().getColor(R.color.white));
            textView.setText("关注");
            return false;

        }
    }

    public static boolean clickGuanzhu(Context context, TextView textView, boolean status, String string) {
        if (status) {
            textView.setBackgroundResource(R.drawable.style_guanzu_to);
            textView.setTextColor(context.getResources().getColor(R.color.textgrey));
            textView.setText(string);

            return true;
        } else {
            textView.setBackgroundResource(R.drawable.style_guanzu);
            textView.setTextColor(context.getResources().getColor(R.color.white));
            textView.setText(string);
            return false;

        }
    }
}
